{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=996
  Verdict: Accepted
}
{$APPTYPE CONSOLE}
type block=record
     b,e,s:longint;
end;
var n,x,y,head,tail,max,k,t,i:longint; b,e,q,s:array[1..100001] of integer; p:array[1..100001] of block;
procedure qsort_b(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=p[b[(l+r) div 2]].b;
repeat
      while p[b[i]].b<x do inc(i);
      while p[b[j]].b>x do dec(j);
      if i<=j then begin
         y:=b[i];
         b[i]:=b[j];
         b[j]:=y;
         inc(i);
         dec(j);
      end;
until i>j;
if l<j then qsort_b(l,j);
if i<r then qsort_b(i,r);
end;
procedure qsort_e(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=p[e[(l+r) div 2]].e;
repeat
      while p[e[i]].e<x do inc(i);
      while p[e[j]].e>x do dec(j);
      if i<=j then begin
         y:=e[i];
         e[i]:=e[j];
         e[j]:=y;
         inc(i);
         dec(j);
      end;
until i>j;
if l<j then qsort_e(l,j);
if i<r then qsort_e(i,r);
end;
procedure qsort_i(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=p[s[(l+r) div 2]].s;
repeat
      while p[s[i]].s<x do inc(i);
      while p[s[j]].s>x do dec(j);
      if i<=j then begin
         y:=s[i];
         s[i]:=s[j];
         s[j]:=y;
         inc(i);
         dec(j);
      end;
until i>j;
if l<j then qsort_i(l,j);
if i<r then qsort_i(i,r);
end;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
readln(n,x);
for i:=1 to n do begin
    readln(x,y);
    p[i].b:=x;
    p[i].e:=x+y;
    p[i].s:=0;
    b[i]:=i;
    e[i]:=i;
    s[i]:=i;
end;
qsort_b(1,n);
qsort_e(1,n);
x:=1;
y:=1;
max:=0;
head:=1;
tail:=0;
k:=0;
while (x<=n) and (y<=n) do begin
      while p[e[y]].e<=p[b[x]].b do begin
            inc(tail);
            q[tail]:=p[e[y]].s;
            inc(y);
            dec(k);
      end;
      t:=p[b[x]].b;
      while (p[b[x]].b=t) do begin
            if tail-head>=0 then begin
               p[b[x]].s:=q[head];
               inc(head);
               inc(k);
            end else begin
                inc(k);
                p[b[x]].s:=k;
            end;
            inc(x);
      end;
      if max<k then max:=k;
end;
writeln(max);
qsort_i(1,n);
for i:=1 to n do write(s[i],' ');
end.